package xyz.xdxx152.mapstruct.mapper;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import xyz.xdxx152.mapstruct.dto.GoodInfoDTO;
import xyz.xdxx152.mapstruct.po.GoodInfo;
import xyz.xdxx152.mapstruct.po.GoodType;

@Mapper(componentModel = "spring")
public interface GoodInfoMapper
{
    //public static GoodInfoMapper MAPPER = Mappers.getMapper(GoodInfoMapper.class);

    @Mappings({
            @Mapping(source = "type.name",target = "typeName"),
            @Mapping(source = "good.id",target = "goodId"),
            @Mapping(source = "good.title",target = "goodName"),
            @Mapping(source = "good.price",target = "goodPrice")
    })
    public GoodInfoDTO from(GoodInfo good, GoodType type);
}